package lookas;

import java.util.HashMap;
import java.util.Map;

import lookas.csvparser.CsvParser;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.wolainfo.simulator.model.tfi.TransactionSharelot;

public class Main{
    private static Log log = LogFactory.getLog(Main.class);

    public static void main(String[] args) throws Exception{
        ApplicationContext context = new ClassPathXmlApplicationContext(
            "context.xml");
        CsvParser parser = (CsvParser)context.getBean("NewCsvParser");

        TransactionSharelot object = new TransactionSharelot();
        object.setFundTransactionId(123);
        parser.getPersistenceDao().findByExample(object);

        Map<String, Integer> warn = new HashMap<String, Integer>();
        String c;
        // -------------------------------------------------------
        //        c = "com.wolainfo.simulator.model.tfi.NavPrice";
        //        warn.put(c, null);
        //        c = "com.wolainfo.simulator.model.tfi.CurrencyExchangeRate";
        //        warn.put(c, null);
        //        c = "com.wolainfo.simulator.model.tfi.Customer";
        //        warn.put(c, null);
        //        c = "com.wolainfo.simulator.model.tfi.Account";
        //        warn.put(c, null);
        //        c = "com.wolainfo.simulator.model.tfi.Transaction";
        //        warn.put(c, null);
        //        c = "com.wolainfo.simulator.model.tfi.FundTransaction";
        //        warn.put(c, null);
        //        c = "com.wolainfo.simulator.model.tfi.Sharelot";
        //        warn.put(c, null);
        //        c = "com.wolainfo.simulator.model.tfi.TransactionSharelot";
        //        warn.put(c, null);
        c = "com.wolainfo.simulator.model.tfi.TransactionBalance";
        //        warn.put(c, null);
        //        c = "com.wolainfo.simulator.model.tfi.TransactionPreferredSharelot";
        warn.put(c, null);
        // -------------------------------------------------------
        try{
            for(String x: warn.keySet())
                warn.put(x, parser.parse(Class.forName(x)));
        }catch(Exception e){
            log.info(e, e);
        }
        for(String x: warn.keySet())
            log.info("Warns: " + x + ": " + warn.get(x));
    }
}
